<template>
  <div>
    <button @click="isShow = !isShow">点我显示/隐藏</button>
    <transition>
      <h2 v-show="isShow">你好啊1！</h2>
    </transition>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  h2 {
    background-color: orange;
    transition: 1s linear;
  }
  /* 来的起点，离开的终点 */
  .v-enter,.v-leave-to {
    transform: translateX(-100%);
  }
  /* 来的终点，离开的起点 */
  .v-enter-to,.v-leave {
    transform: translateX(0%);
  }
</style>